package j10;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author chengshuai
 * @date 2021/5/4 23:44
 */
public class ReEnterLockDemo2 {
    static Lock lock = new ReentrantLock();

    public static void main(String[] args) {
        new Thread(() -> {
            lock.lock();
            lock.lock();
            System.out.println("杜兰特开始打球");
//            lock.unlock();
            lock.unlock();
            System.out.println("杜兰特打球结束");
        }).start();

        new Thread(() -> {
            lock.lock();
            lock.lock();
            System.out.println("杜兰特开始打球2");
            lock.unlock();
            lock.unlock();
            System.out.println("杜兰特打球结束2");
        }).start();
    }
}
